<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        #grand{
            width: 400px;
            height: 400px;
            background-color: aqua;
        }
        #parent{
            width: 300px;
            height: 300px;
            background-color: purple
        }
        #child{
            width: 200px;
            height: 200px;
            background-color: chartreuse;
        }
    </style>
</head>
<body>
    <div id="grand">
        <div id="parent">
            <div id="child"></div>
        </div>
    </div>

    <script>
        let grand = document.getElementById('grand')
        let parent = document.getElementById('parent')
        let child = document.getElementById('child')

        grand.addEventListener('click',()=>{
            console.log('grand')
        }, true)
        parent.addEventListener('click',(e)=>{
            console.log('parent')
            // e.stopPropagation()
            e.stopImmediatePropagation()
        }, true)
        child.addEventListener('click',(e)=>{
            console.log('child')
        }, true)
    </script>
</body>
</html>